<?php

namespace app\api\controller\v2;

use app\api\controller\Common;

class Article extends Common
{
    var $modelDb;

    public function _initialize()
    {
        parent::_initialize();
        $this->modelDb = model("Article");
    }

    public function articlelist()
    {
        $dealerid = $this->uinfo['dealerid'];
        $returnData = [];
        if ($dealerid) {
            $returnData = $this->modelDb->whereOr('dealerid', $dealerid)->whereOr('dealerid', 2)->select();
        } else {
            $returnData = $this->modelDb->where('dealerid', 2)->select();
        }
        return $this->app_success($returnData);
    }

    public function articledetail()
    {
        $id = $this->postData['id'];
        $returnData = $this->modelDb->where('id', $id)->find();
        return $this->app_success($returnData);
    }
}